package nc.ui.am.comparison.deviceass;

import nc.bs.logging.Logger;
import nc.ui.am.comparison.corpdept.CorpDeptCtrl;
import nc.ui.am.comparison.corpdept.CorpDeptEH;
import nc.ui.am.pub.bill.BodyOnlyCardUI;
import nc.ui.pub.bill.BillEditEvent;
import nc.ui.trade.base.IBillOperate;
import nc.ui.trade.bill.ICardController;
import nc.ui.trade.button.IBillButton;
import nc.ui.trade.card.CardEventHandler;
import nc.vo.pub.CircularlyAccessibleValueObject;

public class DeviceassUI extends BodyOnlyCardUI {
 
	private static final long serialVersionUID = 1L;

	public DeviceassUI() {
		super();	
		try {
			((DeviceassEH)getCardEventHandler()).onBoQuery();
		} catch (Exception e) {
			showErrorMessage(e.getMessage());
			Logger.error(e.getMessage(), e); 

		}
	}
	
	protected CardEventHandler createEventHandler() {
		return new DeviceassEH(this, getUIControl());
	}
	
	protected ICardController createController() {
		return new DeviceassCtrl();
	}
	
	@Override
	protected void fillDataToBodyVos(CircularlyAccessibleValueObject[] bodyVos) {
	

	} 

	@Override
	public String getRefBillType() {
	
		return null;
	}

	@Override
	protected void initSelfData() {
		getBillCardPanel().getBodyPanel().getRendererVO().setShowZeroLikeNull(false);
		

	}

	@Override
	public void setDefaultData() throws Exception {
		 

	}
	@Override
	public void afterEdit(BillEditEvent e) {
	
		super.afterEdit(e);
		getBillCardPanel().getBillModel().execLoadFormula();
	}
	
	@Override
	public void updateButtons() { 
		
		if(IBillOperate.OP_EDIT == getBillOperate()){
			getButtonManager().getButton(IBillButton.ImportBill).setEnabled(false);	
		}else{
			getButtonManager().getButton(IBillButton.ImportBill).setEnabled(true);	
		}
		super.updateButtons();
	}
}
